<template>
	<div class="conPpageBox">
		<div class="content">
			<div class="navbar" @click="goBack">
				<img src="../../assets/images/fanhuijiantou.png" alt="">
				{{$t('indexTitle.title14')}}
				<img class="yuyan" src="../../assets/images/yuyan.svg" alt="" />
			</div>
			<div class="category" v-if="!isShowLoading">{{$t('indexTitle.title20')}}</div>
			<div class="promo-list" v-if="!isShowLoading">
				<img class="item" :src="baseURL+it.title_img" alt="" v-for="(it,index) in activityList" :key="index"
					@click="goAvcDetalis(it)" />
			</div>
			<loadingThree v-if="isShowLoading"></loadingThree>
		</div>
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
		<bottom :isSelNav='1'></bottom>
	</div>

</template>

<script>
	import {
		activityList
	} from "../../utils/api.js"
	import bottom from '../../components/bottom.vue'
	import loadingThree from '../../components/loadingThree.vue';
	import loadingFour from '../../components/loadingFour.vue';
	export default {
		components: {
			bottom,
			loadingThree,
			loadingFour
		},
		data() {
			return {
				activityList: [],
				baseURL: process.env.VUE_APP_URL,
				isShowLoading: true,
				msgTextTow: "",
				isShowLoadingTeow: false
			}
		},
		created() {},
		mounted() {
			this.getActivityList()
		},
		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getActivityList() {
				let that = this;
				let data = {
					page: 1
				}
				activityList(data).then((res) => {
					if (res.status.errorCode == 0) {
						console.log(res.data.data);
						this.activityList = res.data.data;
						this.isShowLoading = false;
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			goAvcDetalis(item) {
				this.$router.push({
					path: '/promotiondetail',
					query: {
						id: item.id
					}
				});
			},
			goBack() {
				this.$router.go(-1)
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
	}

	.conPpageBox {
		background-color: #1a1a1a;
		/* height: -webkit-fill-available; */
		height: 90vh;
		padding-bottom: calc(50px + env(safe-area-inset-bottom));
		overflow-y: auto;
		overflow-x: hidden;
		padding-top: calc(constant(safe-area-inset-top) + 0px);
		padding-top: calc(env(safe-area-inset-top) + 0px);
		padding-bottom: calc(constant(safe-area-inset-bottom) + 85px);
		padding-bottom: calc(env(safe-area-inset-bottom) + 85px);
		box-sizing: border-box;
		position: fixed;
		z-index: 1;
		-webkit-overflow-scrolling: touch;
		width: 100%;
	}

	.content {
		height: 100%;
		background-color: #1a1a1a;
		padding: 20px 10px;
		/* min-height: 100vh; */
	}

	.navbar {
		height: 36px;
		text-align: center;
		align-items: center;
		display: flex;
		justify-content: space-between;
		color: #fff;
	}

	.navbar img {
		width: 26px;
		height: 26px;
	}

	.yuyan {
		width: 20px;
		height: 20px;
		border-radius: 50%;
	}

	.category {
		height: 45px;
		line-height: 45px;
		margin: 0 3px;
		margin-top: 15px;
		font-size: 15px;
		color: #dcab4c;
	}

	.promo-list {
		color: #fff;
		margin-top: 20px;
		padding-bottom: 70px;
		max-height: calc(var(--window-inner-height, 100vh) - 185px);
		overflow: auto;
	}

	.item {
		width: 100%;
		height: 120px;
		margin-bottom: 15px;
	}
</style>